#

| Chapter 7 |

# 7. Setting Your Shell Prompt

Contents:
Why Change Your Prompt?
Basics of Setting the Prompt
C Shell Prompt Causes Problems in vi, rsh, etc.
Faster Prompt Setting with Built-Ins
Multiline Shell Prompts
Session Information in Your Terminal's Status Line
A "Menu Prompt" for Naive Users
Highlighting in Shell Prompts
Show Subshell Level with $SHLVL
What Good Is a Blank Shell Prompt?
dirs in Your Prompt: Better than $cwd
External Commands Send Signals to Set Variables
Pre-Prompt Commands in bash

## 7.1 Why Change Your Prompt?

A percent sign (`%`) is the default C shell prompt on many systems. Not too useful, is it? All that prompt tells you is that you're logged in.

If you're good at remembering your current directory name, the computer you're logged in to, your current login name, and more - and, if you never leave your terminal for long - maybe that prompt is enough.

But I forget that kind of stuff. I log in quite a few places and I get interrupted a lot. Without more information in my prompt, I'd always be trying to figure out where I am - typing `pwd` or `who` `am` `I`.

I've changed my prompt to give me the information I need. My prompt can't do everything I want (at least, not on the C shell), but it makes life a lot easier.

Besides, playing around with your prompt can be fun. It's one of the most popular UNIX games, especially for newcomers.

This chapter should get you started. The first few articles cover basics. The rest of the articles show some different prompts and how to make them. Play around. See what works best for you.

- JP

6.10 Running a Command with a Temporarily Different Environment |  | 7.2 Basics of Setting the Prompt